// TOWN SCRIPT
//    Town 3: Dusty temple

// This is the special encounter script for this town.
// The states INIT_STATE, EXIT_STATE, and START_STATE have
// meanings that are described in the documentation. States you write
// yourself should be numbered from 10-100.

begintownscript;

variables;

body;

beginstate INIT_STATE;
// Called upon entering

//Intro text for this town
if(get_flag(3,2) == 0) {
	reset_dialog();
	add_dialog_str(0,"You enter this building, and look around. It is clearly a very large, very dusty temple; rows upon rows of prayer mats line the floor, covered in rubble, and at the northern end of the building there is a large white marble altar.",0);
	add_dialog_str(1,"Carefully looking around for any signs of life, or any statues, you don't spot anything - whatever the reason the angel was pointing you in this direction, it wasn't trying to ambush you.",0);
	add_dialog_str(2,"At least, not yet. You keep your hand near your weapon just in case, and slowly move forward.",0);
	run_dialog(1);
	set_flag(3,2,1);
}

set_name(6,"Rentar Ihrno");
break;

beginstate EXIT_STATE;
// Always called when the town is left.
break;

beginstate START_STATE;
// Called every turn.

break;

//Move back to Town 2
beginstate 10;
	move_to_new_town(0,20,16);
break;

//Sarcophagus in W room
beginstate 11;
	if(get_flag(3,0) == 0) {
		message_dialog("This sarcophagus is sealed shut - no amount of pushing, pulling or prying is going to budge the lid. After a couple of minutes of fruitless work, you leave it alone.","Whatever, or rather whoever, is lying in there will remain undisturbed.");
		set_flag(3,0,1);
	} else {
		message_dialog("You still can't budge the lid - rather than spend another five minutes trying (in vain) to open it, you move on.","");
	}
break;

//Entry to western chamber
beginstate 12;
	if(get_flag(3,1) == 0) {
		message_dialog("You enter this small chamber and are taken aback by the splendour of the decoration. Whilst the room is every bit as dusty as the rest of the temple, it is still clear that a great deal of effort went into the building and decoration of this room.","At the far end of the room there is a simple stone sarcophagus, tightly sealed. Whoever is buried inside it must have been terribly important to command such impressive surroundings.");
		set_flag(3,1,1);
	}
break;

//the youth are starting to change, are you starting to change, are you together, together, together


//Half-way along temple
beginstate 13;
	if(get_flag(3,3) == 0) {
		play_sound(58);
		play_sound(-59);
		message_dialog("As you approach the altar you hear a door opening behind you. As you spin around, it slams shut. You draw your weapons but there is nobody there. Oddly, the doors you came through into the temple are still open...","Spooked, you turn back to the altar, keeping your weapons close to your hands...");
		set_flag(3,3,1);
	}
break;

//Statue room, steps
beginstate 14;
	if(get_flag(3,4) == 0) {
		reset_dialog();
		add_dialog_str(0,"As you enter this small room, your heart stops. Four large statues stand against the walls, facing out. You frantically try to watch as many of them as you can, not wanting to let any of them disappear.",0);
		add_dialog_str(1,"However, after a moment you realise that these statues aren't moving, despite the fact you keep having to look away from one to watch another. Nor are they shaped like the other statues you saw earlier - these ones do not have wings.",0);
		add_dialog_str(2,"You sheathe your weapons and let out a laugh - the idea of statues vanishing into thin air is preposterous, and here you are jumping at the slightest thing...",0);
		add_dialog_str(3,"After a moment, you regain your composure, and look around - the room is featureless, apart from the statues and a narrow set of stairs descending down into the ground. You wonder what's down there...",0);
		run_dialog(1);
		set_flag(3,4,1);
	}
break;

//Stairs down
beginstate 15;
	if(get_flag(250,0) == 0) {
		move_to_new_town(4,24,6);
	} else {
		message_dialog("There is no reason to go back down there.","");
		block_entry(1);
	}
break;

//Altar
beginstate 16;
	if(get_flag(3,5) == 0) {
		message_dialog("You draw close to the temple's altar - it is still quite impressive, even after years of neglect. You can only imagine how awe-inspiring it once was.","The white marble stone doesn't appear to be enchanted in any way, but it still provides a strong focal point.");
		set_flag(3,5,1);
	}
break;